package com.fz.controller;

import com.fz.service.CateStoresService;
import com.fz.service.CategoryService;
import com.fz.service.RoleResService;
import com.fz.service.TPermissionService;
import com.fz.vo.CateStoresVo;
import com.fz.vo.ResultVo;
import com.fz.vo.RoleResVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 商品门店关联表 前端控制器
 * </p>
 *
 * @author fz
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/cateStores")
public class CateStoresController {
    @Resource
    CategoryService categoryService;
    @Resource
    CateStoresService cateStoresService;
    @GetMapping("/getCate")
    ResultVo<CateStoresVo> getCate(Long storesId){
        return ResultVo.success(new CateStoresVo(categoryService.getList(),cateStoresService.getByStoresId(storesId)));
    }
    @PostMapping("/save")
    ResultVo<Boolean> save(Long storesId, Long[] menuIds, Long[] btnIds){
        return ResultVo.success(cateStoresService.save(storesId, menuIds, btnIds),"分配成功");
    }
}
